package com.ats.developer.components
{
	import com.ats.developer.components.borderpint.BorderPoint;
	import com.ats.developer.components.borderpint.DashBorder;
	
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	import mx.core.UIComponent;
	import mx.managers.CursorManager;
	
	[Style(name="tightDashBorder",dashlen="2",gaplen="2")]
	
	public class FormItem extends Canvas
	{
		protected var _productUUID:String;   //产品ID
		
		public function get productUUID():String
		{
			return _productUUID;
		}
		
		public function set productUUID(value:String):void
		{
			_productUUID = value;
		}
		public function FormItem()
		{
			super();
			this.horizontalScrollPolicy="off";
			this.verticalScrollPolicy="off"
			this.addEventListener(MouseEvent.MOUSE_OVER,mouseOverHandler);
			this.addEventListener(MouseEvent.MOUSE_OUT,mouseOutHandler);
//			this.addEventListener(MouseEvent.MOUSE_DOWN,doMouseEvent);
		}
		
		public function showBorder():void{
			this.setStyle("borderSkin",com.ats.developer.components.borderpint.DashBorder);
			this.setStyle("borderThickness","1.5");
			this.setStyle("borderColor","#000000");
			this.setStyle("borderStyle","solid");
//			this.styleName="tightDashBorder";
			this.isSelect=true;
		}
		public function hideBorder():void{
			this.setStyle("borderSkin",null);
			this.setStyle("borderThickness",null);
			this.setStyle("borderColor",null);
			this.setStyle("borderStyle",null);
			this.styleName="";
			this.isSelect=false;
		}
		public function showBorderPoint():void{
			for(var obj:Object in this.getChildren()){
				if(this.getChildren()[obj as Number] is BorderPoint){
					(this.getChildren()[obj as Number] as UIComponent).visible=true;
				}
			}
		}
		public function hideBorderPoint():void{
			for(var obj:Object in this.getChildren()){
				if(this.getChildren()[obj as Number] is BorderPoint){
					(this.getChildren()[obj as Number] as UIComponent).visible=false;
				}
			}
		}
		
//		public function doMouseEvent(event:MouseEvent):void{
//			if(!isSelect){
//				this.showBorder();
//			}
//			event.currentTarget.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandel);
//			event.currentTarget.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
//		}
		
		public var isSelect:Boolean=false;
		
		protected function add(obj:UIComponent):void{
			if(obj is BorderPoint){
				obj.visible=false;
			}
			this.addChild(obj);
		}
		
		[Embed(source="/assets/img/resizeCursorVH.gif")]
		protected var VHRESIZECURSOR:Class;
		
		protected function mouseOverHandler(event:MouseEvent):void
		{
			CursorManager.setCursor(VHRESIZECURSOR,3,-10,-10);
		}
		
		
		protected function mouseOutHandler(event:MouseEvent):void
		{
			CursorManager.removeAllCursors();
		}
//		public function getMinHeight():Number{
//			return 6;
//		}
//		public function getMinWidth():Number{
//			return 6;
//		}

	}
}